function longtime() {
    for (let i = 0; i < 1000000; i++) {}
}
const numbers = []
for (let i = 0; i < 1000; i++) {
    numbers.push(i)
}

let start = new Date().getTime()
longtime()
console.log(new Date().getTime() - start)
start = new Date().getTime()
numbers
    .map((v) => {
        longtime()
        return v
    })
    .map((v) => {
        longtime()
        return v
    })
    .map((v) => {
        longtime()
        return v
    })
    .filter((num) => {
        longtime()
        return num > 2
    })
    .filter((num) => {
        longtime()
        return num > 2
    })
    .filter((num) => {
        longtime()
        return num > 2
    })
    .reduce((t1, t2) => {
        longtime()
        return t1 + t2
    }, 0)
console.log(new Date().getTime() - start)
start = new Date().getTime()
numbers
    .map((v) => {
        longtime()
        return v
    })
    .filter((num) => {
        longtime()
        return num > 2
    })
    .reduce((t1, t2) => {
        longtime()
        return t1 + t2
    }, 0)
console.log(new Date().getTime() - start)
